#include "CommonFunction.h"


// convert int to string
string itos( int i ){
	string result;
	stringstream buf;
	buf<<i;
	buf>>result;
	buf.clear();
	return result;
}

void Split( string line, string label, vector<string> *column ){
	column->clear();
	int pos = line.find( label );
	int id = 0;
	while( pos != -1 ){
		column->push_back( line.substr( 0, pos ) );
		line = line.substr( pos + 1, line.length() - pos - 1 );
		pos = line.find( label );
	}
	if( line != "" )
		column->push_back( line );
}

void Split( string line, string label, list<string> *column ){
	column->clear();
	int pos = line.find( label );
	int id = 0;
	while( pos != -1 ){
		column->push_back( line.substr( 0, pos ) );
		line = line.substr( pos + 1, line.length() - pos - 1 );
		pos = line.find( label );
	}
	if( line != "" )
		column->push_back( line );
}

int GetOppositeOri( int o )
{
	if( o == PLUS )
		return MINUS;
	else
		return PLUS;
}
